@use '../partials/mixin' as mx;

.CSS_START_components_settings {
    display: none;
}

$settings_bg: var(--color-brand-secondary);
$setting_color: var(--color-brand-primary);

.settings_container {
    display: flex;
    height: 597px;

    input[type='range'], input[type="checkbox"] {
        accent-color: $setting_color;
    }

    &:not(:has(.guidedTour_content)) {
        @media screen and (height <= 700px) {
            height: 450px;
        }
    }

    &:has(.guidedTour_content) {
        @media screen and (height <= 700px) {
            height: 510px;
        }
    }

    .section {
        padding-bottom: 15px ;
        border-bottom: 2px solid var(--color-gray-50);
        margin: 10px 0 20px;
        width: calc(100% - 40px);
        display: flex;
        flex-direction: column;
        gap: 5px;

        input[type="range"] {
            width: 150px;

            &.range_inactive {
                accent-color: grey;

                &::-webkit-slider-thumb {
                    width: 2em;
                    padding: 0.25em;
                    border: 1px solid var(--color-disabled);
                    border-radius: 50%;
                    box-shadow: 0 0 .5em #FFF inset;
                    background: linear-gradient(#888, #FFF) content-box,
                        linear-gradient(-90deg, #888, #DDD) border-box;
                }
            }
        }

        .btn_primary {
            width: fit-content;
            padding: 0 5px;
            height: 35px;
            border: 1px solid var(--color-button-border);
            border-radius: 5px;
            background-color: $settings_bg;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            color: $setting_color;

            &:focus-within, &:focus {
                outline: var(--color-brand-primary) solid 1px !important;
                outline-offset: 2px;
                border-radius: 5px;
                background-color: var(--color-brand-primary);
                color: var(--color-neutral-base)!important;
            
                svg {
                  fill: var(--color-neutral-base)!important;
                  color: var(--color-neutral-base)!important;
                }
              }

            p {
                font-size: 14px;
            }

            svg {
                width: 20px;
                height: 16px;
                fill: $setting_color;
            }
        }
    }

    h4 {
        margin: 0;
        font-weight: 600;
    }
}

.modal_dialog_reader .settings_container {
    &:not(:has(.guidedTour_content)) {
        @media screen and (height <= 750px) {
            height: calc(100dvh - 150px);
            min-height: 550px;
        }
    }
}

.settings_tabslist {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    border-right: 2px solid var(--color-gray-100);
    padding-top: 20px;
    background-color: var(--color-gray-50);
    gap: 5px;

    button {
        height: 30px;
        transition: 200ms;
        // width: 80%;
        display: flex;
        align-items: center;
        justify-content: left;
        margin: 0 10%;
        gap: 10px;
        padding: 5px;
        border-radius: 6px;
        font-weight: normal;
        border: 1px solid transparent;

        h3 {
            font-size: 14px;
            text-overflow: ellipsis;
            overflow: hidden;
            max-width: 180px;
            white-space: nowrap;
            font-weight: unset;
        }

        &:hover {
            background-color: var(--color-neutral-base);
            border: 1px solid var(--color-button-border);
            color: var(--color-brand-primary);

            svg {
                color: var(--color-brand-primary);
                fill: var(--color-brand-primary);
            }
        }

        &[data-state="active"]{
            color: $setting_color;
            background-color: $settings_bg;
            border: 1px solid var(--color-button-border);

            svg {
                fill: $setting_color;
            }
        }

        &:focus {
            position: relative;
         }

        svg {
            width: 15px;
            transition: 200ms linear;
        }
    }

    .allowCustom {
        margin: 10px 10%;
        gap: 5px;
    }

    button[data-value="tab-text"], button[data-value="tab-spacing"] {
        margin-left: 20%;
    }
}

.allowCustom {
    display: flex;
    accent-color: var(--color-brand-primary);
    // margin: 10px;
    gap: 5px;


    input {
        height: 12px;
    }

    label {
        font-size: 12px;
    }
}

.tablist_reading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    border-bottom: 1px solid var(--color-gray-400);
    margin-bottom: 20px;

    button {
    transition: 200ms;
    height: 100%;
    width: 100px;
    gap: 10px;
    margin: 0 !important;
    border-bottom: 1px solid transparent;
    font-weight: normal;
    flex-direction: column;

        &:hover {
            background-color: var(--color-gray-400);
        }

        &[data-state="active"]{
            color: $setting_color;
            background-color: $settings_bg;
            border-bottom: 2px solid $setting_color;

            svg {
                width: 30px;
                height: 30px;
            }
        }

        &:focus {
            position: relative;
            }

        svg {
            width: 25px;
            height: 25px;
            transition: 200ms linear;
        }

        p {
            margin: 5px;
        }
    }
}

.settings_content {
    flex: 2;
    overflow: hidden scroll;
    margin-top: 50px;
    margin-bottom: 5px;

    @include mx.scrollbar_styling;

    .button_transparency_icon {
        position: relative;

        svg {
            position: absolute;
            transform: translate(-50%,-50%);
            left: 50%;
            top: 50%;
            fill: $setting_color;
            height: 15px;
        }
    }
}

[data-theme="dark"] {
    .button_transparency_icon svg {
        color: var(--color-text-primary);
        fill: var(--color-text-primary);
    }
}

[data-theme="system"] {
    @media (prefers-color-scheme: dark) {
        .button_transparency_icon svg {
            color: var(--color-text-primary);
            fill: var(--color-text-primary);
        }
    }
}

.close_button_div {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: transparent;
    width: 63%;
    z-index: 10;
    padding: 0 0 10px 10px;

    div {
        display: flex;
        align-items: center;
        gap: 5px;
        margin-bottom: 10px;
    }

    .settings_tab_title {
        margin: 0;

        h2 {
            margin: 0;
        }
    }
}

.reset_button {
    width: 20px;
    height: 20px;
    padding: 5px;
    border-radius: 5px;
    transition: 200ms;
    box-sizing: content-box;
    border: 1px solid transparent;

    &:active, &:hover {
        border: 1px solid var(--color-brand-primary);
        background-color: var(--color-brand-secondary)!important;
    }

    svg {
        color: var(--color-brand-primary);
    }
}

.popover_dialog_reader .settings_tab {
    margin: 30px 20px 0!important;
}

.settings_tab {
    margin: 30px 25px 0!important;

    &_container {
    margin: 35px;

    &_reading {
        margin: 0 25px;

        .size_range {
            display: flex;
            align-items: center;
            height: 30px;
            gap: 10px;

            input {
                cursor: pointer;
            }

            button {
                width: 20px;
                height: 20px;
                padding: auto;
            }

            p {
                padding: 5px;
                width: 50px;
                text-align: center;
                background-color: $settings_bg;
                border-radius: 5px;
            }
        }

        &_spacing {
            display: grid;
            grid-template-columns: repeat(2, 1fr);

            @media screen and (width <= 820px) {
                display: block;
            }

            .section {
                width: 90%!important;

                .size_range {
                    display: flex;
                    align-items: center;
                    gap: 5px;
                    height: 30px;

                    .range_inactive {
                            accent-color: grey;

                            &::-webkit-slider-thumb {
                                width: 2em;
                                padding: 0.25em;
                                border: 1px solid var(--color-disabled);
                                border-radius: 50%;
                                box-shadow: 0 0 .5em #FFF inset;
                                background: linear-gradient(#888, #FFF) content-box,
                                    linear-gradient(-90deg, #888, #DDD) border-box;
                            }
                        }

                    input[type="range"] {
                        width: 150px;
                        height: 5px;
                    }
                }

                label {
                    font-weight: 600;
                }

                p {
                    font-size: 14px;
                }

                h4 {
                    margin: 0;
                    max-width: 120px;
                }
            }

            .session_text {
                display: flex;
                align-items: start;
                justify-content: flex-start;
                gap: 10px;
                font-size: 14px;
                background-color: var(--color-gray-300);
                color: var(--color-text-primary);
                padding: 5px 10px;
                border-radius: 5px;
                margin: 10px 0;

                p {
                    margin: 5px 0;
                }

                svg {
                    margin-top: 5px;
                    width: 25px;
                    height: 25px;
                    color: $setting_color;
                }
            }
        }
    }
    }

    &_title {
        display: flex;
        align-items: start;
        justify-content: flex-start;
        margin: 0 25px 20px;
        font-size: 16px;
        gap: 10px;

        h2 {
            margin-top: 0;
        }

        button[data-state="open"] .advanced_trigger {
            background-color: var(--color-brand-secondary);
            border-color: var(--color-brand-primary);
        }
    }

    .session_text {
        display: flex;
        align-items: start;
        justify-content: flex-start;
        gap: 10px;
        width: fit-content;
        font-size: 14px;
        background-color: var(--color-gray-50);
        color: var(--color-text-primary);
        padding: 5px 10px;
        border-radius: 5px;
        margin: 10px 0;

        p {
            margin: 5px 0;
        }

        svg {
            margin-top: 5px;
            width: 16px;
            height: 16px;
            color: $setting_color;
        }
    }
}

.select {
    &_trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 0 25px 0 10px;
    border: 1px solid var(--color-text-primary);
    border-radius: 4px;
    height: 35px;
    width: 300px;

    > div {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    }

    &_icon {
        width: 24px;
        height: 24px;
    }

    &_item {
        line-height: 2;
        border-radius: 3px;
        display: flex;
        align-items: center;
        height: 25;
        padding: 0 35px 0 25px;
        position: relative;
        border-bottom: 1px solid var(--color-gray-400);
        color: var(--color-text-primary);
        font-size: 14px;

        &:hover {
            cursor: pointer;
            background-color: $settings_bg;
            color: $setting_color;
        }
    }

    &_content {
        overflow: hidden;
        background-color: var(--color-neutral-base)!important;
        opacity: 1;
        border-radius: 4px;
        z-index:10001;
        border: 1px solid var(--color-gray-400);
        width: 300px;
        max-height: 300px;
        font-size: 14px;
    }
}

div[data-radix-popper-content-wrapper] {
    position: fixed!important;
}

.scale_button {
    scale: 1.3;
    color: var(--color-brand-primary);
    border-radius: 4px;
    width: 15px;
    height: 15px;
    text-align: center;
    border: 1px solid transparent;
    position: relative;
    padding: 3px;
    box-sizing: content-box;
    transition: 200ms;

    span {
        position: absolute;
        transform: translate(-50%, -50%);
        left: 50%;
        top: 50%;
    }

    &:active, &:hover {
        border: 1px solid var(--color-brand-primary);
        background-color: var(--color-brand-secondary)!important;
    }
}

.spacing_heading {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;

    p {
        width: fit-content;
        padding: 2px 4px;
        border-radius: 4px;
        text-align: center;
        background-color: var(--color-gray-300);
    }
}


.settings_reading {
    &_text {
        input[type="range"] {
            width: 200px;
            height: 5px;
        }

        .label_fontSize, .label_fontFamily {
            margin: 10px 0 20px;
        }

        select.form_group {
            height: 30px !important;
            width: 300px;
        }

        .size_range {
            display: flex;
            align-items: center;
            gap: 10px;

            p {
                padding: 0;
                text-align: center;
                background-color: transparent;
            }
        }
    }
}


.display_options {
    display: flex;
    font-size: 14px;
    height: 80px;
    list-style-type: none;

    svg {
        width: 30px;
        height: 30px;
    }

    &_item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 95px;
        padding-top: 5px;
        border: 1px solid transparent;
        border-radius: 6px;
        transition: 200ms linear;
        min-height: 70px;
        background-color: var(--color-gray-50);

        &:hover:not([disabled])  {
            border: 1px solid $setting_color;
            background-color: $settings_bg;
            cursor: pointer;
        }

    }

    div[role="radiogroup"] {
        button {
            transition: 200ms linear;

            &[data-state="checked"] {
                border: 1px solid $setting_color;
                background-color: $settings_bg;
                color: $setting_color;

                svg {
                fill: $setting_color;
                }
            }
        }
    }
}

.settings_font{
    &_container {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;

        &:hover {
            border: none transparent;
            box-shadow: none;
        }

        > svg {
            position: absolute;
            left: 10px;
            width: 24px;
            height: 24px;
        }
    }

    &_selection {
    padding: 0 0 0 35px;
    border: 1px solid var(--color-text-primary);
    border-radius: 4px;
    width: 300px;
    height: 35px;

    &__control {
        display: flex;
        align-items: center;
        width: 100%;
        height: 30px;
        border: none;
        margin-right: 0;
        background-color: var(--color-neutral-base)!important;

        &:hover {
            box-shadow: none;
        }
        }

        &__value-container {
            padding: 0;
            color: var(--color-text-primary)!important;
            height: 25px;
        }

        &__input {
            width: 220px!important;
            padding-left: 5px!important;
            height: 23px!important;
        }

        &__menu {
            left: 0;
            background-color: var(--color-neutral-base)!important;
            color: var(--color-text-primary)!important;
            z-index: 2000000;

            > div {
                border: 1px solid black;

                > div:hover {
                        cursor: pointer;

                    }

            }
        }
    }
}

.maths_options {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: start;
    gap: 5px;
}

.toggleCustom {
    position: absolute;
    bottom: 30px;
    left: 20px;
    width: 190px;
    display: flex;
    align-items: start;
    border: 0 solid var(--color-brand-primary);
    border-radius: 5px;

    p {
        font-size: 14px;
    }

    label .label {
    display: inline-block;
    width: 9em;
    user-select: none;
    }

    label input[role="switch"] {
    opacity: 0;
    }

    label input[role="switch"] ~ .state {
    display: inline-block;
    user-select: none;
    }

    label input[role="switch"] ~ .state > .container {
    position: relative;
    top: 2px;
    display: inline-block;
    border: 1px solid transparent;
    width: 30px;
    height: 18px;
    border-radius: 11px;
    background-color: #61646B;
    cursor: pointer;
    }

    label input[role="switch"] ~ .state > .container > .position {
    position: relative;
    top: 1px;
    left: 2px;
    display: inline-block;
    border: 2px solid white;
    border-radius: 9px;
    width: 12px;
    height: 12px;
    background: white;
    }

    label input[role="switch"]:not(:checked) ~ .state span.on {
    display: none;
    }

    label input[role="switch"]:checked ~ .state > span.off {
    display: none;
    }

    label input[role="switch"]:checked ~ .state > .container {
    background-color: #0B8454;

    > .position {
        left: 12px;
        border-color: white;
        background: white;
        opacity: 1;
    }
    }

    &.focus {
    border-width: 2px;
    outline: none;
    background-color: #def;
    }

    &.focus span.container,
    &:hover span.container {
    background-color: white;
    }
}


.settings_theme_container {
    border-radius: 6px;
    border-width: 1px;
    border-style: solid;
    border-color: var(--color-gray-300);
    width: 85px;
    height: 45px!important;
    min-height: 45px!important;
    text-decoration: none;
    box-shadow: 0 2px 15px rgb(0 0 0 / 0%);
    transition: all 0.3s;
    padding: 0;
    background-color: var(--color-neutral-base);
    margin: 0!important;
    display: flex!important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;

    &::after {
        content: "";
        width: inherit;
        height: inherit;
        position: absolute;
        top: -6px;
        right: -8px;
        border-radius: 6px;
        border-right: 1px solid var(--color-gray-300);
        border-top: 1px solid var(--color-gray-300);
    }

    svg {
        width: 12px;
        height: 12px;
        position: absolute;
        top: 2px;
        right: 5px;
    }
}

.preset_settings_container {
    > div {
        button {
            margin-bottom: 10px;
        }

        &:nth-child(-n + 2) {
            margin-bottom: 20px;
        }

        &:last-child {
            position: absolute;
            bottom: 10px;

            // @media screen and (height <= 600px) {
            //     position: relative;
            // }
        }
    }
}

.notification_preset {
    position: absolute;
    top: 8px;
    right: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-brand-primary);
    animation: blink 3s ease-in-out infinite;

    @keyframes blink {
        0% {
          opacity: 1;
        }

        50% {
            opacity: 0.1;
        }

        100% {
          opacity: 1;
        }
      }
}

.profile_selection {
    &_form {
        margin: 0 20px 20px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
        position: relative;
    }

    &_input {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        height: fit-content;
        padding: 10px;
        border-radius: 6px;
        width: 100%;
        transition: 200ms ease-in-out;

        input {
            position: absolute;
            opacity: 0;
            width: 1px;
            height: 1px;
            margin: -1px;
            pointer-events: none;
        }

        &_checked {
            color: var(--color-brand-primary);
            background-color: var(--color-brand-secondary);
            border: 1px solid var(--color-button-border);
        }

        &:hover:not(:has(.profile_selection_input_checked)) {
            background-color: var(--color-gray-275);
            cursor: pointer;

            .profile_selection_label {
                cursor: pointer;
            }
        }

        &:focus-within:has(input:focus) {
            outline: 2px solid var(--color-button-border);

            // & > input:focus {
            //     outline: none!important;
            // }
        }

        .delete_profile_button button {
            border-radius: 2px;
            outline-offset: 2px;

            &:hover {
                outline: 2px solid var(--color-brand-primary);
            }

            &:focus {
                outline: 2px solid var(--color-button-border)!important;
            }
        }
    }

    &_label {
        display: flex;
        align-items: start;
        justify-content: flex-start;
        gap: 10px;
        width: inherit;

        > div {
            height: fit-content;
            // max-height: 75px;
            display: flex;
            justify-content: center;
        }

        > img, svg {
            width: 75px;
        }
    }

    &_description {
        display: flex;
        flex-direction: column;
        align-items: start;
        text-align: start;
        gap: 10px;

        p, h5 {
            margin: 0;
        }
    }
}

.CSS_END_components_settings {
    display: none;
}
